<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<html>
<head>
    <title>编辑配置</title>

    <jsp:include page="/include/common.jsp" />
    <script type="text/javascript" src="<c:url value="/resources/lib/jquery/plugin/jquery.form.min.js" />"></script>
    <script type="text/javascript" src="<c:url value="/resources/js/verify.js" />"></script>
</head>
<body>

<form id="myFormSystemUser" name="" method="post" enctype="multipart/form-data">
    <table class="table-container">
        <tr>
            <td class="item-name">&nbsp;</td>
            <td class="item-value">
                <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitEdit()">提交</a>
                <a href="javascript:void(0)" class="easyui-linkbutton" onclick="closeWindow('#wSystemUser')">取消</a>
            </td>
        </tr>
        <c:if test="${sysConfig != null}">
        <tr>
            <td class="item-name">编号：</td>
            <td class="item-value">
                <div>${sysConfig.id}</div>
                <input type="hidden" name="id" value="${sysConfig.id}" />
            </td>
        </tr>
        </c:if>


        <tr>
            <td class="item-name">任务距离：</td>
            <td class="item-value">
                <input type="text" name="distance" value="${sysConfig.distance}" />
            </td>
        </tr>



    </table>
</form>
<style>
    #specify_goods > div {
        float: left;
    }
    .style-comm {width: 360px !important;}
    #specify_goods li{
        list-style:none;
    }
    .tipCode {
        color: red;
        font-size: 13px;
        font-weight: 400;
    }
</style>

<script type="text/javascript">
    $(function () {
//        $('#modelType').combobox({
//            //url:'itemManage!categorytbl',
//            editable:false, //不可编辑状态
//            cache: false,
//            panelHeight: 'auto'//自动高度适合
//        });
    });
    //下面用于图片上传预览功能
    function setImagePreview(avalue) {

        $("#isImgChange").val(true);

        var docObj=document.getElementById("doc");
        var imgObjPreview=document.getElementById("preview");
        if(docObj.files &&docObj.files[0]){
            //火狐下，直接设img属性
            imgObjPreview.style.display = 'block';
//            imgObjPreview.style.width = '150px';
//            imgObjPreview.style.height = '180px';
            //imgObjPreview.src = docObj.files[0].getAsDataURL();
            //火狐7以上版本不能用上面的getAsDataURL()方式获取，需要一下方式
            imgObjPreview.src = window.URL.createObjectURL(docObj.files[0]);
        }else{
            //IE下，使用滤镜
            docObj.select();
            var imgSrc = document.selection.createRange().text;
            var localImagId = document.getElementById("localImag");
            //必须设置初始大小
//            localImagId.style.width = "150px";
//            localImagId.style.height = "180px";
            //图片异常的捕捉，防止用户修改后缀来伪造图片
            try{
                localImagId.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale)";
                localImagId.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgSrc;
            }catch(e){
                $.messager.alert('警告','您上传的图片格式不正确，请重新选择!','warning');
                return false;
            }
            imgObjPreview.style.display = 'none';
            document.selection.empty();
        }
        return true;
    }

    /**
     * 提交数据
     */
    function submitEdit(){

        $("#myFormSystemUser").form('submit', {

            url: '<c:url value="/web/admin/sysConfig/saveOrUpdate.action" />',
            onSubmit: function(){
                if(!$("#myFormSystemUser").form('validate')){
                    return false;
                }
                $.messager.progress({
                    title:'操作中',
                    msg:'正在操作。。。'
                });
                return true;
            },
            success: function(data){
                $.messager.progress('close');
//                if(data.status == 0){
                $("#wSystemUser").window('close');
                $('#listObject').datagrid('reload');
//                }else {
//                    $.messager.alert("错误提醒", "网络错误", 'error');
//                }
            }
        });
    }
</script>



</body>
</html>
